package com.sansi.pencilbook.mapper;

import com.sansi.pencilbook.entity.UseCategory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.sql.SQLException;
import java.util.List;

/**
 * 功能说明:
 *
 * @author lsy13
 */
@Mapper
public interface UseCategoryMapper {

    @Select("SELECT c2.category_name as 'category_parent', c1.category_name as 'category_name', c1.category_id as 'category_id', c2.category_id as 'category_parent_id' " +
            "FROM category as c1 left join category as c2 " +
            "on c1.category_parent = c2.category_id;")
    public List<UseCategory> findAll() throws SQLException;

}
